package com.manage.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clms.common.R;
import com.manage.mapper.IntegralMapper;
import com.manage.pojo.entity.TbIntegrationHistory;
import com.manage.pojo.vo.IntegralVo;
import com.manage.service.IntegralService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 积分业务层
 * @author: 林子洁
 * @create: 2021-07-23 20:24
 **/
@Service
public class IntegralServiceImpl implements IntegralService {
    @Resource
    private IntegralMapper integralMapper;

    @Override
    public R initIntegral(Integer currentPage, Integer pageSize, IntegralVo integralVo) {
        Page<TbIntegrationHistory> historyPage = new Page<>(currentPage,pageSize);
        integralMapper.selectPage(historyPage,null);
        return R.ok().put("records",historyPage.getRecords()).put("total",historyPage.getTotal());
    }

    @Override
    public R deleteIntegral(Integer id) {
        integralMapper.deleteById(id);
        return R.ok().message("好了");
    }
}
